package com.itheima.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.itheima.bean.Orders;
import com.itheima.common.R;
import com.itheima.dto.PageParemDto;
import com.itheima.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrdersService ordersService;
    @GetMapping("/page")
    public R order(PageParemDto pageParemDto){
        System.out.println(pageParemDto);
        IPage<Orders> page = ordersService.findpage(pageParemDto);
        return R.success(page);
    }
    @PutMapping
    public R updatestatus(@RequestBody Orders orders){
        if (ordersService.UpdateStatus(orders)>0){
            return R.success("更新成功！");
        }
        return R.error("更新失败！");
    }
}
